<?php

        define("GRID_SOURCE", "");       
        
        include(GRID_SOURCE."class/gridclasses.php"); //Include the grid engine.
        
	require_once "../funciones.php";
        session_start();
       
        //Define identifying name(s) to your grid(s). Must be unqiue name(s).
        $grid_id = array("grid");

        //Remember to comment the again line when publishing PHP Grid, or else PHP Grid wont remember the settings between page loads.
        unset($_SESSION["grid"]);
        include(GRID_SOURCE."class/gridcreate.php"); //Creates grid objects.
        
?>
<html>
        <head>
                <title>View Grid</title>
                <script language="Javascript" type="text/javascript" src="<?php print(GRID_SOURCE);?>javascript/javascript.js"></script>
                <link href="<?php print(GRID_SOURCE);?>css/style.css" rel="stylesheet" type="text/css">
                <link rel="stylesheet" type="text/css" media="screen" href="../css/caweb.css" />
				<script type='text/javascript' src="<?php print(GRID_SOURCE);?>server.php?client=all"></script>
				<script>
				HTML_AJAX.defaultServerUrl = '<?php print(GRID_SOURCE);?>server.php';
				</script>
                <script src="caweb2.js"></script>
                <script src="../js/jquery.js" type="text/javascript"></script>
                <script src="../js/caweb.js" type="text/javascript"></script>
        </head>

        <body>

	<?php

	if ($_SESSION['caweb']['iniciar'] == 1)
	{
	?>
		<form name="pedidos" method="POST" action="adiciona_req.php">
                    <table>
                        <tr>
                            <td>
                                <div><label for="clasetx">Clase</label>
                                    <select name="clase" id="clasetx" class="mayusculas" onchange="funcion_subclases(this.value,0,1); funcion_pasasesion('clase',this.value);">
                                    <option value='' SELECTED>Seleccionar..</option>
                                    <?php
                                        $link_intranetpccom = con_intranetpccom();
                                        $sql ="SELECT * FROM clases where estado = 1 order by descripcion";
                                        $result64=mysql_query($sql,$link_intranetpccom) or die('Error Clase, '.mysql_error().$sql);
                                        while($row64 = mysql_fetch_array($result64)){
                                            echo "<option value='{$row64['codigoclase']}'>{$row64['descripcion']}</option>";
                                        }
                                    ?>
                                </select>
                                </div>
                            </td>
                            <td>
                                <div id="layer2_subclases"></div>
                            </td>
                            <td>
                                <div id="layer2_familias"></div>
                            </td>
                            <td>
                                <div id="layer2_grupos"></div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="8">
                                <label for="observacion">Otra especificacion:</label><input type="text" id="observacion" size="25" name="observacion" value="">
                            </td>
                        </tr>
                </table>

                <br>Cantidad :<input type="text" id="cantidad" size="5" name="cantidad" value="">
                Tarifa :<input type="text" id="tarifa" size="10" name="tarifa" value="">
                <br>
                <table border=1><tr><td>Memoria<td>Disco<td>Video<td>Red<td>Fax<td>Optico<td>Otro<td>Software</tr><tr>
                <td><input type="text" id="memoria" size="10" name="memoria" value=""></td>
                <td><input type="text" id="disco" size="10" name="disco" value=""></td>
                <td><input type="text" id="video" size="10" name="video" value=""></td>
                <td><input type="text" id="red" size="10" name="red" value=""></td>
                <td><input type="text" id="fax" size="10" name="fax" value=""></td>
                <td><input type="text" id="optico" size="10" name="optico" value=""></td>
                <td><input type="text" id="otro" size="10" name="otro" value=""></td>
                <td><input type="text" id="software" size="10" name="software" value=""></td></tr>
                </table>
                <input name="guardar" type="submit" value="Adicionar" />
                </form>

                <?php

			$transaccion=$_SESSION['caweb']['consecutivo'];
			echo  "Ultimo Item ".$_SESSION['caweb']['ultimoitem'];
                        if ($_SESSION['caweb']['resultado'] == 1) { echo "<font color=green><b> CORRECTO </b></font>"; }
                        if ($_SESSION['caweb']['resultado'] == 2) { echo "<font color=black><b> Sin datos </b></font>"; }
                        if ($_SESSION['caweb']['resultado'] == 3) { echo "<font color=red><b> INTERNO EN TRANSACCION $transaccion </b></font>"; }

			$consecutivo=$_SESSION['caweb']['consecutivo'];
			$condicion="transaccion='$consecutivo'";
                        $_SESSION["grid"]->SetDatabaseConnection($_SESSION['caweb']['basededatos'], "caweb", "caweb");
				$_SESSION["grid"]->SetSqlSelect('id,cantidad,pendiente,clase,item,tarifa,memoria,disco,
					optico,software,observacion',
					'temporal_ped',$condicion);
				$_SESSION["grid"]->SetUniqueDatabaseColumn("id", false);
				$_SESSION["grid"]->SetTitleName("Ingreso de Items para requisiciones");
				$_SESSION["grid"]->SetEditModeEdit(true);
				$_SESSION["grid"]->SetMaxRowsEachPage(15);
        	                $_SESSION["grid"]->SetDatabaseColumnEditable("id", false);
				$_SESSION["grid"]->SetDatabaseColumnEditable("cantidad", true);
				$_SESSION["grid"]->SetDatabaseColumnEditable("pendiente", true);
				$_SESSION["grid"]->SetDatabaseColumnEditable("clase", false);
                	        $_SESSION["grid"]->SetDatabaseColumnEditable("item", true);
        	                $_SESSION["grid"]->SetDatabaseColumnEditable("tarifa", true);
				$_SESSION["grid"]->SetDatabaseColumnEditable("memoria", true);
				$_SESSION["grid"]->SetDatabaseColumnEditable("disco", true);
				$_SESSION["grid"]->SetDatabaseColumnEditable("observacion", true);
				$_SESSION["grid"]->SetShowExcelIco(false);
				$_SESSION["grid"]->SetShowPrintIco(true);
				$_SESSION["grid"]->PrintGrid(MODE_EDIT);
	}
                ?>
        </body> 
</html>
